<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<img id="light" src="../imgs/off.gif"> <br>
<div class="cls">传智教育</div>   <br>
<div class="cls">黑马程序员</div> <br>
<input type="text" id="username">
<input type="checkbox" name="hobby"> 电影
<input type="checkbox" name="hobby"> 旅游
<input type="checkbox" name="hobby"> 游戏
<br>
<script>
    //① 点亮灯泡
    var img = document.getElementById("light");
    img.src = "../imgs/on.gif";
    /*② 将所有的 div 标签的标签体内容替换为 呵呵
         给div元素设置边框*/
    var divs = document.getElementsByTagName("div");
    for (const div of divs) {
        // div.innerText = "呵呵";
        div.innerHTML = "嘿嘿";
        div.style.color = "red";
        div.style.border = "1px blue solid";
        div.style.width = "50px";
    }
    //③ 给输入框设置默认值
    var usernameInput = document.getElementById("username");
    usernameInput.value = "请输入用户名。。。";
    //④ 使所有的复选框呈现被选中的状态
    var hobbys = document.getElementsByName("hobby");
    for (const hobby of hobbys) {
        hobby.checked = true;
    }

</script>
</body>
</html>